using System;
using Anvil.Core;
using Anvil.Core.Commands;

namespace Anvil.Extras.Commands
{
	/// <summary>
	/// Set a key in the context to today's date (DateTime).
	/// </summary>
	public class SetKeyToday : BaseLogic
	{
		private string _KeyID = null;

		/// <summary>
		/// The name of the key field.
		/// </summary>
		public string KeyID
		{
			get { return _KeyID; }
			set { _KeyID = value; }
		}

		public override bool RequestExecute(IRequestContext context)
		{
			context[KeyID] = DateTime.Today;
			return CONTINUE;
		}
	}
}